//
//  PBMySuggestCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2018/4/4.
//  Copyright © 2018年 tmkj. All rights reserved.
//

#import "PBMySuggestCell.h"
@interface PBMySuggestCell()
@property (strong, nonatomic) IBOutlet UILabel *typeLabel;
@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
@property (strong, nonatomic) IBOutlet UILabel *desLabel;
@end

@implementation PBMySuggestCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWithModel:(PBMySuggestModel *)model {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"YYYY/MM/dd hh:MM:ss";
    // 数字时间戳转化为日期，如果为13位，则需要除以1000，或者去掉后3位
    NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:[[model.insertTime substringWithRange:NSMakeRange(0, 10)] doubleValue]];
    NSString *startTime = [formatter stringFromDate:startDate];
    self.timeLabel.text = startTime;
    if (model.type == 1) {
        self.typeLabel.text = @"投诉";
    }else if (model.type == 2) {
        self.typeLabel.text = @"建议";
    }
    self.desLabel.text = model.bizContent;
}

@end
